package com.zhanggm.zyk.pay.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * https://blog.csdn.net/xwh041213/article/details/135565395
 * https://open.alipay.com/develop/sandbox/account
 * ???????????
 * https://opendocs.alipay.com/open/59da99d0_alipay.trade.page.pay?pathHash=e26b497f&ref=api&scene=22
 * https://natapp.cn/tunnel/lists
 * evania5752@sandbox.com/111111
 *
 */
public class AlipayConfig {

	// ???ID,????APPID???????????????APPID???????????
	public static String app_id = "9021000135626649";
	
	// ???????????PKCS8???RSA2??
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5fdtLD5XC+vk2HC2SakBO2dxlso9K8sG4UXYpRjtCO3ekU2EfFyIR1/1vHm38ahntbI3ISqcV26B38t0ySe+DcBBxpmdrt+lRIqTQ0gvQQ12q+h5l09eahbz/qM0hnzZx05yHDSXQ/AZ24cz+I40Z2Kg/UROv2tAGFBPlZmR7sINcXb7Y+JTvw8PX9NTe7Jha70CHC61dnIZG61+t595kLURRRIlQeMcDWgmee8YdXVa3xKMxlxISrTJ3AWwd6AkJNrONO8qUAqoP61vTkvP9dj04SyKm7KAX2+m+I+C3ms6WoZP05fDV2YxuI9qxa2QzG8PRxoLSbxx8eiDo7oEhAgMBAAECggEBALJQW7Qvmj9i9plewyxiOcnTQzz8RyW8ch+XJ+kLm8HS2vO8N7wkh9rxcK8WaJLjCGOmHDI0GaU4iW1lqeBDFR2caCJo3ji+Bmu5ywj3MuYVLIFFil1HJZdlA0gd5HxyymroCywEpprc+/XioSaZ1HXJQgwEC9HcnmeJe4rmQKhpZBxpSsS6D8tQSByRHgUT9VhxpNQ83QwpJTO91mblY6CRIzPQrK8Ni1z7h1BCcPATEke9oy/xxkYPE/YdyLWvOZtp18hbuzJ5U80ksIQbEIvY2cQqyf9KKxjJjUeZg+NrsVxbfWDRd0dY1XdxT9RsNY6UuchkbVrdlDWkqjL9BfUCgYEA9XzRI30zJHF5DifUq8yqglSPTrgAjrmU3pLkKWhhXLpfiWSNa7PIFZJAkR06p5C02lnyyE96qbSIZe/v8kAkkGLit12H/FW6pO16x5HBWKC5rvo3ft3EM7577UGibnSdb+4ZeK+gI3O72uz/pxfkgYercxEgKhQ8IQZj/iMjussCgYEAwW9T8yQAW2T9EngGZ2+emsBFx2+SBS/1ElHlb6soGlKHwTxA2gWp80FHB1bck7+w0YZFgSgFu52pbNEc8qM2wfarF41+CDQD1anlbKO3caKhRGjxkTlFcVKr9byDeum41CkGpp7bChVgsSIxNBOCxfh1uO4ii90fQhIPyAFUGkMCgYEAxJcPWM9TnHSu0BI/stE1Hygel5itAZ9Gw7N4ulxX1A2AoqN+yWhw7C1yPYPdzAELg+0Siy1y+uKTdKbgTezmGybFjrh9RStWS+vOLnHgF1ynNqQ0uwlXrWR3E/pC3RfQWKmhhk+G+70cDGdNGH/+w2hlecGWM3x+5qeafhOf8l8CgYAQzZfwThdN2Sb2vMBpqdOQQ9WL7pAzrSfP0JdqrOaN6s9qJM7JYaaSv//ojk4Y85TrjotpHc3pr1dxYXTvSuhNzxyrrhndoo8Wt2x7lHkyANubcrZRVDVJE9JmRVryiW0J2Qp/3NrQNG0y1fKKQIuioOOxDdaoaav2dFU0nZDtuwKBgDYgL808rjSK0KWfF2CgOt/mqezOnVA/NcO1Qzd88L5O+BsbsY8WPaJ/Z0JdE8O/PWUCfD64k1QVZPypf9LKsDnlr/cjmf1N71OuVjX11ljwZLU11+I2Coyarbsxd+r/g+4VFRznt2ciMR9ddbrttatfD242gBEzK0/KXlTUWDim";

    // ????????,???????https://openhome.alipay.com/platform/keyManage.htm ???APPID?????????????
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAltLYAZ9WoChrPcILADpkr8PppAoe6DvXmohD0CVv7j1Iv7hA1HoPVi6W4QZI2WeaKhD828EJokpzWdDDbqpLwFnUlYpLbtN/dLHvhSz6CZOZjibFfyjQniJnIy4aijGaFKsUpBBZKWsIKvugdFKzLkaLoOOVK9bioce+I4DZ1XbyQJANT3NWyoMoG44Ql+wCDk0eaFTbnAd///E2HzAwLzIJNVqRYgKhr/kshnOW+lTz6sDOG1gI/yFcMD7duO9zbvDT0reNpBeTN9JWthSUUUDcdE9q3aAsf1inD0wPzeNByCweg3U645o9qLuvGiN1TPGKFZQneblnhuKNHNZIOQIDAQAB";

	// ?????????????�??  ??http://?????????�??????????id=123??????????????????????????????????
	public static String notify_url = "http://localhost/notify_url.jsp";

	// ??????????????�?? ??http://?????????�??????????id=123??????????????????????????????????
	public static String return_url = "http://localhost:8080/pay/list";

	// ??????
	public static String sign_type = "RSA2";
	
	// ?????????
	public static String charset = "GBK";
	
	// ?????????
	public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
	
	// ?????????
	public static String log_path = "/home/logs/";

    /**
     * ??????????
     */
    public static final String TRADE_SUCCESS = "TRADE_SUCCESS";
    /**
     * ?????????
     */
    public static final String TRADE_CLOSED = "TRADE_CLOSED";


    /** 
     * ??????????????????????????????????????????
     * @param sWord ?????????????????
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

